﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tiDE.SourceInsight
{
    public static class InsightManager
    {
        internal static Dictionary<string, ISourceInsightProvider> InsightProviders;

        public static void AddInsightProvier(ISourceInsightProvider Provider)
        {
            if (InsightProviders == null)
                InsightProviders = new Dictionary<string, ISourceInsightProvider>();
            foreach (string filetype in Provider.SupportedFileTypes)
            {
                InsightProviders.Add(filetype, Provider);
            }
        }

        public static ISourceInsightProvider GetProviderForExtension(string Extension)
        {
            if (InsightProviders == null)
                InsightProviders = new Dictionary<string, ISourceInsightProvider>();
            if (InsightProviders.ContainsKey(Extension))
                return InsightProviders[Extension];
            if (InsightProviders.ContainsKey("." + Extension))
                return InsightProviders["." + Extension];
            return null;
        }
    }
}
